package org.example.demo4.utils;

import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.google.common.collect.Maps;

import io.jsonwebtoken.Claims;

/**
 * 通用常量信息
 * 
 * @author fmf
 */
public class Constants
{
	
	public static final int power_eidt_true = 1;  // 有编辑权限      
	public static final int power_eidt_false = 0;      
	
	
	public static final int best_price_yes = 1;  // 最优价格
	public static final int best_price_no = 0;  // 不是最优价格  
	
	
	public static Map<Long, String> deptDict = Maps.newHashMap();
	public static Map<Long, String> areaDict = Maps.newHashMap();
	
	public static final int import_price_max_num = 5000; 
	
	public static final int waybill_order_normal = 0;      // 运单的前置单没有修改
	public static final int waybill_order_change = 1;      // 运单的前置单有修改
	
	public static final int sap_header_undeal = 0;      // 未处理
	public static final int sap_header_dealfail = 1;      // 处理失败
	public static final int sap_header_receivefail = 2;      // 收货处理失败 
	public static final int sap_header_dealsuc = 3;      // 处理成功 
//	public static final int sap_header_unreceive = 3;      // 收货未处理
//	public static final int sap_header_receivefail = 4;      // 收货处理失败 
//	public static final int sap_header_receivesuc = 5;      // 收货处理成功

	
	public static final String supplier_login_token = "supplier_login_tokens";    

	public static final int OA_PRICE_CREATE = 0;      // 价格调整类型-新增
	public static final int OA_PRICE_UPDATE = 1;      // 价格调整类型-修改

	public static final int order_delivery = 1;      // 交货单
	public static final int oroer_transfer = 2;      // 转储单
	public static final int oroer_production = 3;      // 生产订单	
	public static final int oroer_other = 4;      // 其他
	public static final int oroer_stock = 5;      // 备货单
	public static final int oroer_tob = 6;      // TOB单据
	
	public static final int delivery_out = 1;      // 外向交货
	public static final int delivery_inner = 2;      // 内向交货
	
	public static final long order_customer = 2;      // 客户
	public static final long order_supplier = 1;      // 供应商
	
	
	
	 
	public static final int freight_adjustment_type_add = 0;      // 价格调整类型-新增
	public static final int freight_adjustment_type_modify = 1;      // 价格调整类型-修改

	 
	
	public static final int freight_request_add = -1;      // 流程-新增审批
	public static final int freight_request_modify = 0;      // 流程-修改审批
	public static final int freight_request_refuse = 1;      // 流程-拒绝
	public static final int freight_request_adopt = 2;      // 流程-通过

	public static final int freight_type_special_car = 0;      // 专车/整车
	public static final int freight_type_express_by_volume = 1;   // 快运-体积
	public static final int freight_type_express_by_weight = 2;   // 快运-重量
	public static final int freight_type_small_express_by_volume = 3;  // 快递-重量
	public static final int freight_type_fixed_monthly_payment = 4;    // 包月
	public static final int freight_type_special_train  = 5;    // 紧急专车

	
	
	public static final String cache_area_key = "cache_area_key";      // 省市区字典的缓存
	public static final String cache_provider_key = "cache_provoder_key";      // 供应商字典的缓存
	
	
	
	public static final int freight_addition_zxf = 0;      // 装卸费
	public static final int freight_addition_slf = 1;   // 上楼费
	public static final int freight_addition_fcf = 2;   // 分仓费
	public static final int freight_addition_khdf = 4;  // 客户到付
	public static final int freight_addition_qt = 5;    // 其他
	public static final int freight_addition_jjzc = 6;    // 紧急专车

	public static final int freight_addition_tsbt = 7;    // 特殊补贴
	public static final int freight_addition_wxsh = 8;    // 外箱损耗
	
	
	// 新线路招标报价
 	public static final int  BID_PRICE_not_quoted = 0;   // 未报价
 	public static final int  BID_PRICE_returned  = 1;    // 已报价
 	public static final int  BID_PRICE_quoted  = 2;      // 退回报价
 	public static final int  BID_PRICE_into_price  = 3;   // 写入价格库
 	public static final int  BID_PRICE_WZB  = 4;       // 未中标
 	
 	
    /**
     * 数据逻辑正常
     */
    public static final int BID_PUSH = 1;
    
    
	public static  String SAP_URL = "47.99.39.43";
	public static  String SAP_HTTP_PORT = "50000";
	public static  String SAP_HTTPS_PORT = "50001";

	@Value("${sap.host}")
	public  void setSapIP(String sapIP) {
		SAP_URL = sapIP;
	}
	@Value("${sap.httpPort}")
	public  void setSapHttpPort(String sapHttpPort) {
		SAP_HTTP_PORT = sapHttpPort;
	}
	@Value("${sap.httpsPort}")
	public  void setSapHttpsPort(String sapHttpsPort) {
		SAP_HTTPS_PORT = sapHttpsPort;
	}
	
    /**
     * 数据逻辑正常
     */
    public static final int OPE_SUC = 0;
    
    /**
     * 数据逻辑正常
     */
    public static final int OPE_ERROR = 1;
	
    /**
     * 数据逻辑正常
     */
    public static final int DATA_NORMAL = 0;
    
    /**
     * 数据逻辑正常
     */
    public static final int BID_upload_file = 1;

    /**
     * 数据逻辑删除
     */
    public static final int DATA_DELETE = 1;
    
    
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

	public static int GYLZX_DEPT_ID = 209;  // 供应链
	public static int DLSGYB_DEPT_ID = 245;  // 大零售营销中心供应部

	
	
    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";
    public static final String ajax_SUCCESS = "SUCCESS";
    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

    /**
     * 登录用户 redis key
     */
    public static final String LOGIN_TOKEN_KEY = "login_tokens:";

    /**
     * 防重提交 redis key
     */
    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";

    /**
     * 限流 redis key
     */
    public static final String RATE_LIMIT_KEY = "rate_limit:";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = Claims.SUBJECT;

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config:";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict:";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi:";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap:";

    /**
     * LDAPS 远程方法调用
     */
    public static final String LOOKUP_LDAPS = "ldaps:";

    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.zhende.common.utils.file" };
}
